package com.cf.r944_ak;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class b {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        int t = Integer.parseInt(br.readLine());
        while (t-- > 0) {
            char[] s = br.readLine().toCharArray();
            boolean ans = false;
            for (int i = 1; i < s.length; i++) {
                if (s[i - 1] != s[i]) {
                    ans = true;
                    char tmp = s[i];
                    s[i] = s[i - 1];
                    s[i - 1] = tmp;
                    break;
                }
            }
            if (ans) {
                out.println("YES");
                out.println(new String(s));
            } else {
                out.println("NO");
            }
        }
        out.flush();
        out.close();
        br.close();
    }
}
